<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="__CDN__/assets/addons/exam/js/vue.js"></script>
<link rel="stylesheet" type="text/css" href="__CDN__/assets/addons/exam/css/common.css"></link>
<script src="__CDN__/assets/addons/exam/js/element-ui/index.js"></script>
<link rel="stylesheet" type="text/css" href="__CDN__/assets/addons/exam/js/element-ui/index.css"></link>

<div id="app">
    <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Cate_id')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-cate_id" data-rule="required" data-source="exam/cate/selectpage"
                       data-params='{"custom[kind]":"QUESTION","isTree":true}' class="form-control selectpage" name="row[cate_id]"
                       type="text" value="">

                <p class="text-info">* 此处选择的题库分类，并不涉及试题抽取，仅用于区分试卷所属题库及付费使用区分</p>
            </div>
        </div>

        <!--<div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Kind')}:</label>
            <div class="col-xs-12 col-sm-8">

                <select  id="c-kind" data-rule="required" class="form-control selectpicker" name="row[kind]">
                    {foreach name="kindList" item="vo"}
                        <option value="{$key}" {in name="key" value="RANDOM"}selected{/in}>{$vo}</option>
                    {/foreach}
                </select>

            </div>
        </div>-->
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text"
                       placeholder="请输入试卷名称">
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('题型说明')}:</label>
            <div class="col-xs-12 col-sm-8">
                <div id="c-desc">
                    <textarea id="c-desc" class="form-control editor" name="row[desc]" data-rule="required"></textarea>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('题型说明录音')}:</label>
            <div class="col-xs-12 col-sm-8">
                <div class="input-group">
                    <input id="c-desc_audio" class="form-control" size="50" name="row[desc_audio]" type="text" data-rule="required">
                    <div class="input-group-addon no-border no-padding">
                        <span><button type="button" id="plupload-desc_audio" class="btn btn-danger plupload" data-input-id="c-desc_audio" data-mimetype="audio/ogg,audio/mpeg,audio/wav" data-multiple="false" data-preview-id="p-desc_audio"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                        <span><button type="button" id="fachoose-desc_audio" class="btn btn-primary fachoose" data-input-id="c-desc_audio" data-mimetype="audio/ogg,audio/mpeg,audio/wav" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        <span><button type="button" class="btn btn-success soundupload" data-input-id="c-desc_audio"><i class="fa fa-upload"></i> 录音</button></span>
                    </div>
                    <span class="msg-box n-right" for="c-desc_audio"></span>
                </div>
                <ul class="row list-inline plupload-preview" id="p-desc_audio"></ul>
            </div>
        </div>


        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Quantity')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-quantity" data-rule="required" class="form-control" name="row[quantity]" type="number" step="1"
                       min="1" value="100" placeholder="请输入试卷总题数">
            </div>
        </div>
        <input id="c-total_score" data-rule="required" class="form-control" name="row[total_score]" type="hidden"
                       step="1" min="1" value="100" >
        <!-- <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Total_score')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-total_score" data-rule="required" class="form-control" name="row[total_score]" type="number"
                       step="1" min="1" value="100" placeholder="请输入试卷总分数">
            </div>
        </div> -->
        <!-- <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Pass_score')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-pass_score" data-rule="required" class="form-control" name="row[pass_score]" type="number"
                       step="1" min="1" placeholder="请输入及格分数">
            </div>
        </div> -->
        <input id="c-pass_score" data-rule="required" class="form-control" name="row[pass_score]" type="hidden"
                       step="1" min="1" value="1">

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Mode')}:</label>
            <div class="col-xs-12 col-sm-8">

                <div class="radio">
                    {foreach name="modeList" item="vo"}
                    <label for="row[mode]-{$key}">
                      <input @change="changeMode" id="row[mode]-{$key}" name="row[mode]" type="radio" value="{$key}" {in name="key" value="RANDOM" }checked{/in} /> {$vo}
                    </label>
                    {/foreach}
                </div>

            </div>
        </div>

        <div v-show="mode === 'RANDOM'" >
            <div class="form-group" >
                <label class="control-label col-xs-12 col-sm-2">{:__('题库取题')}:</label>
                <div class="col-xs-12 col-sm-8">

                    <div class="radio">
                        {foreach name="cateList" item="vo"}
                        <label for="row[cate_type]-{$key}">
                            <input id="row[cate_type]-{$key}" name="row[cate_type]" type="radio" value="{$key}" {in name="key" value="0" }checked{/in} /> {$vo}
                        </label>
                        {/foreach}
                    </div>

                </div>
            </div>
        </div>
        

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Configs')}:</label>
            <div class="col-xs-12 col-sm-8" v-show="mode === 'RANDOM'" id="div_random_configs">
                <input id="c-configs" class="form-control hide" name="row[configs]" type="text">
                <!--<a href="javascript:;" class="btn btn-sm btn-success btn-configs"><i class="fa fa-cog"></i> 随机选题配置</a>-->

                {include file="../application/admin/view/exam/paper/configs_setting.html" /}
            </div>

            <div class="col-xs-12 col-sm-8" v-show="mode === 'FIX'">
                <a href="javascript:;" class="btn btn-sm btn-success btn-fix-configs margin-bottom" @click="openQuestionSelect()"><i class="fa fa-cog"></i> 固定选题配置</a>

                {include file="../application/admin/view/exam/paper/configs_setting_fix.html" /}
            </div>

        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Limit_time')}:</label>
            <div class="col-xs-12 col-sm-8" style="line-height: 31px;">
                <input id="c-limit_time" data-rule="required" class="form-control hide" name="row[limit_time]" type="number"
                       step="1" min="0" value="0" style="width: 200px" placeholder="考试限时，0不限制">

                <input id="c-limit_time_hour" data-rule="required" class="form-control" name="row[limit_time_hour]"
                       type="number" step="1" min="0" max="23" value="0" style="width: 100px" placeholder="考试限时小时">时
                <input id="c-limit_time_minute" data-rule="required" class="form-control" name="row[limit_time_minute]"
                       type="number" step="1" min="0" max="60" value="60" style="width: 100px" placeholder="考试限时分钟，0不限制">分
            </div>
        </div>

        <!-- <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Day_limit_count')}:</label>
            <div class="col-xs-12 col-sm-8" style="line-height: 31px;">
                <input id="c-day_limit_count" data-rule="required" class="form-control" name="row[day_limit_count]" type="number"
                       step="1" min="0" value="0" style="width: 200px" placeholder="考试限时，0不限制">
            </div>
        </div> -->

        <!-- <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-start_time" data-rule="match(lte, row[end_time], date);" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-end_time" data-rule="match(gte, row[start_time], date);" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="">
                <p class="text-info">* 试卷使用时间，清空则不限制试卷使用时间</p>
            </div>
        </div> -->

        <!-- <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Is_only_room')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-is_only_room" name="row[is_only_room]" type="hidden" value="{$row.is_only_room|default=0}">
                <a href="javascript:;" data-toggle="switcher" class="btn-is_only_room" data-input-id="c-is_only_room" data-yes="1" data-no="0" >
                    <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
                </a>
                <p class="text-info">* 开启该功能后，该试卷将不再显示于前端试卷列表，仅考场可使用</p>
            </div>
        </div> -->

        <!--<div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="">

                <p class="text-info">* 试卷结束使用时间，清空则不限制试卷使用时间</p>
            </div>
        </div>-->

      <!-- <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('uses')}:</label>
        <div class="col-xs-12 col-sm-8">

          <div class="radio">
            {foreach name="usesList" item="vo"}
            <label for="row[uses]-{$key}">
              <input id="row[uses]-{$key}" name="row[uses]" type="radio" value="{$key}" {in name="key" value="ALL" }checked{/in} />
              {$vo}</label>
            {/foreach}
          </div>

        </div>
      </div>

      <div class="form-group uses">
        <label class="control-label col-xs-12 col-sm-2">{:__('price')}:</label>
        <div class="col-xs-12 col-sm-8">
          <input id="c-price" data-rule="required" class="form-control" name="row[price]" type="number" step="0.01" min="0" value="0" placeholder="请输入普通用户价格">
        </div>
      </div>

      <div class="form-group uses uses-member">
        <label class="control-label col-xs-12 col-sm-2">{:__('member_price')}:</label>
        <div class="col-xs-12 col-sm-8">
          <input id="c-member_price" data-rule="required" class="form-control" name="row[member_price]" type="number" step="0.01" min="0" value="0" placeholder="请输入会员用户价格">
        </div>
      </div>

      <div class="form-group uses uses-member">
        <label class="control-label col-xs-12 col-sm-2"> </label>
        <div class="col-xs-12 col-sm-8">
          <p class="text-info">* 若题库设置了收费，题库付费或激活后，仍然需要付费才能使用该试卷（建议开启题库收费后，不再设置试卷费用）</p>
        </div>
      </div> -->

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
            <div class="col-xs-12 col-sm-8">

                <div class="radio">
                    {foreach name="statusList" item="vo"}
                    <label for="row[status]-{$key}">
                        <input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="NORMAL" }checked{/in} /> {$vo}</label>
                    {/foreach}
                </div>

            </div>
        </div>
        <div class="form-group layer-footer">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
                <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
            </div>
        </div>

    </form>

</div>

<!--试卷设置扩展-->
{include file="../application/admin/view/exam/paper/extend.html" /}
